﻿
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta name="format-detection" content="telephone=yes" />
    <meta name="format-detection" content="email=no" />
    <title>勘查信息手机版</title>
    <link rel="stylesheet" type="text/css" href="css/css.css" />
    <meta content="勘查信息手机版" name="keywords" />
    <style type="text/css">
        .overlay {
            position: fixed;
            top: 0;
            right: 0;
            bottom: 0;
            left: 0;
            z-index: 998;
            width: 100%;
            height: 100%;
            _padding: 0 20px 0 0;
            background-color: rgba(51, 51, 51, 0.8);
            display: none;
        }

        .showbox {
            position: fixed;
            top: 0;
            left: 50%;
            z-index: 9999;
            opacity: 0;
            filter: alpha(opacity=0);
            margin-left: -80px;
        }

        *html .showbox, *html .overlay {
            position: absolute;
            top: expression(eval(document.documentElement.scrollTop));
        }

        #AjaxLoading div.loadingWord {
            width: 180px;
            height: 50px;
            line-height: 50px;
            border: 2px solid #fe8323;
            background: #fff4e8;
            text-align: center;
        }
    </style>
</head>
<body>
    <div class="mtzrl_box">
        <div class="mq_top">
            <div class="btn_back_l">
                <a class="btn_back" onclick="history.go(-1)">
                    <span></span>
                    <nav>返回</nav>
                </a>
            </div>
            <div class="mq_title">
                个人登陆
            </div>
            <div class="btn_ch_r">
            </div>
        </div>
        <div class="log_box">
            <ul>
                <li class="username">
                    <input type="text" value="" placeholder="个人用户名" id="T_Account" />
                </li>
                <li class="pwd">
                    <input type="password" value="" placeholder="密码" id="T_Password" />
                </li>
                <li class="login_free">
                    <div>
                        <input type="checkbox" class="inputCheckbox" id="online" />
                        <label>
                            30天内自动登录
                        </label>
                    </div>
                </li>
                <li class="btn_submit">
                    <button type="submit" id="btnall">
                        登 录
                    </button>
                </li>
                <li class="reg_findpwd"><a href="javascript:;">忘记密码</a></li>
            </ul>
        </div>
        <div class="footer">
            <div class="footer_top">
                <ul class="back_top">
                    <li><a href="javascript:scroll(0,0)">TOP</a></li>
                </ul>
            </div>
            <ul class="copyright">
                <li>
                    <a href="javascript:;">电脑版</a><span>|</span><a href="javascript:;">普通版</a><span>|</span><a href="javascript:;">用户反馈</a><span>|</span><a href="javascript:;">联系我们</a>
                </li>
                <li>&copy;Copyright 北京中资房产 by 房产估价系统1.0 </li>
            </ul>
        </div>
    </div>
    <script type="text/javascript" src="js/jquery.js"></script>
    <script type="text/javascript" src="js/layer/layer.js"></script>
    <script type="text/javascript">
        var ApiUrl = "http://localhost:6260/";
        if (!jQuery.support.cors) {
            jQuery.support.cors = true;
        }
        $(function () {
            $("#online").click(function () {
                var storage = window.localStorage;
                if (this.checked) {
                    storage.setItem("online", "ok");
                } else {
                    storage.removeItem("online");
                }
            });

            $("#btnall").click(function () {
                if ($("#T_Account").val() == "" || $("#T_Password").val() == "") {
                    layer.msg('账号和密码不能为空!', { icon: 4, time: 1000 });
                } else {
                    var par = {
                        T_Account: $("#T_Account").val(),
                        T_Password: $("#T_Password").val()
                    }
                    DengluALL(par);
                }
            });

            /*是否自动登录*/
            var storage = window.localStorage;
            var online = storage.getItem('online');
            var account = storage.getItem('account');
            var pwd = storage.getItem('pwd');
            if (online == null || online == "" || online == undefined ||
               account == null || account == "" || account == undefined ||
               pwd == null || pwd == "" || pwd == undefined) {
                //location.href = "login.html";
            }
            else {
                if (online == "ok") {
                    var par = {
                        T_Account: account,
                        T_Password: pwd
                    }
                    Denglu(par);
                }
            }
        });

        //登录ajax
        function DengluALL(par) {
            $.ajax({
                type: "post",
                url: ApiUrl + "api/Login/GetLogin",
                data: par,
                success: function (data, status) {
                    if (status == "success") {
                        if (data.state) {
                            var storage = window.localStorage;
                            storage.setItem('token', data.token);
                            storage.setItem("userid", data.userid);
                            storage.setItem("account", data.account);
                            storage.setItem("name", data.name);
                            storage.setItem("pwd", data.pwd);
                            location.href = "Index.html";
                            layer.msg('登录成功!', { icon: 1, time: 1000 });
                        } else {
                            layer.msg(data.message, { icon: 2, time: 1000 });
                        }
                    }
                },
                error: function (e) {
                    layer.msg('服务器链接超时!', { icon: 2, time: 1000 });
                },
                complete: function () {
                }
            })
        }
    </script>
</body>
</html>
